package 第二类.service.impl;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.springframework.stereotype.Service;
import 第二类.domain.Administrator;
import 第二类.mapper.AdministratorMapper;
import 第二类.service.AdministratorService;

import java.io.IOException;
import java.io.InputStream;

@Service("AdminitstratorService")
public class AdministratorServiceImpl implements AdministratorService {
    private InputStream resourceAsStream = Resources.getResourceAsStream("SqlMapConfig.xml");
    private SqlSessionFactory sqlSessionFactory=new SqlSessionFactoryBuilder().build(resourceAsStream);
    private SqlSession sqlSession = sqlSessionFactory.openSession();
    private AdministratorMapper mapper = sqlSession.getMapper(AdministratorMapper.class);

    public AdministratorServiceImpl() throws IOException {
    }

    @Override   //管理员查询
    public Administrator findAdministrator(Administrator administrator) {
        Administrator administrator1 = mapper.findAdministrator(administrator);
        return administrator1;
    }
}
